package net.huashitong.user.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.user.dao.BranchDao;
import net.huashitong.user.entity.Branch;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BranchService extends StringPKService<Branch> {
    @Autowired
    private SysTableService tableService;
    @Autowired
    private BranchDao dao;

    @Override
    protected BaseDao<Branch, String> getDao() {
        return dao;
    }

    @Override
    protected void beforeSave(Branch branch) {
        branch.setSysId(tableService.updateMaxSysId("t_bnp_branch", null));
    }
    public List<Branch> getBranchByType(String branchType){
        return dao.getBranchByType(branchType);
    }
}
